import { Component, Vue } from "vue-property-decorator";
import { GlobalMenu } from "@/components/global-menu/global-menu";
import { JsCookies } from "@/utils/js-cookie";

@Component({
  props: {
    routes: {
      type: Array,
      required: true
    }
  },
  components: {
    GlobalMenu
  }
})
export class HeaderBar extends Vue {
  private versionInfo: string = "";
  private versionVisible: boolean = false;
  private spinning: boolean = false;

  created() {}

  logout() {
    this.$confirm({
      title: `${this.$t("confirm")}`,
      content: `${this.$t("confirmLogout")}`,
      okText: `${this.$t("ok")}`,
      cancelText: `${this.$t("cancel")}`,
      parentContext: this,
      onOk: async () => {
        JsCookies.removeCookie("authorization");
        JsCookies.removeCookie("user");

        this.$router.push({
          name: "login"
        });
      }
    });
  }
}

export default HeaderBar;
